@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Premium Color Palette */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --dark-gradient: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  
  /* Message Colors */
  --bot-msg-bg: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  --user-msg-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.2);
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  padding: 20px;
  overflow: hidden;
}

/* Animated Background */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Floating Particles Effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

.msger {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  height: 90vh;
  max-height: 700px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  position: relative;
  z-index: 1;
  animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msger-header {
  background: var(--primary-gradient);
  color: white;
  padding: 24px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.msger-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.msger-header-title {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.msger-header-title i {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.msger-chat {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.msger-chat::-webkit-scrollbar {
  width: 8px;
}

.msger-chat::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.msger-chat::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  transition: var(--transition-smooth);
}

.msger-chat::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #764ba2 0%, #667eea 100%);
}

.msg {
  display: flex;
  align-items: flex-end;
  margin-bottom: 20px;
  animation: messageSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  animation-fill-mode: forwards;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-img {
  width: 48px;
  height: 48px;
  margin-right: 12px;
  background: var(--success-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-bounce);
  flex-shrink: 0;
}

.msg-img:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: var(--shadow-md);
}

.msg-img img {
  width: 32px;
  height: 32px;
  object-fit: cover;
}

.msg-bubble {
  max-width: 70%;
  padding: 16px 20px;
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
  position: relative;
}

.msg-bubble:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.msg-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 12px;
}

.msg-info-name {
  font-weight: 600;
  font-size: 0.875rem;
  opacity: 0.9;
}

.msg-info-time {
  font-size: 0.75rem;
  opacity: 0.6;
  font-weight: 500;
}

.msg-text {
  line-height: 1.6;
  font-size: 0.95rem;
  word-wrap: break-word;
}

/* Bot Message */
.left-msg .msg-bubble {
  background: white;
  color: #2d3748;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.left-msg .msg-info-name {
  color: #667eea;
}

/* User Message */
.right-msg {
  flex-direction: row-reverse;
}

.right-msg .msg-img {
  margin-right: 0;
  margin-left: 12px;
  background: var(--secondary-gradient);
}

.right-msg .msg-bubble {
  background: var(--user-msg-bg);
  color: white;
  border-bottom-right-radius: 4px;
  border: none;
}

.right-msg .msg-info-name {
  color: rgba(255, 255, 255, 0.95);
}

.right-msg .msg-info-time {
  color: rgba(255, 255, 255, 0.7);
}

/* Input Area */
.msger-inputarea {
  display: flex;
  padding: 20px;
  gap: 12px;
  background: white;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  align-items: center;
}

.msger-input {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid rgba(102, 126, 234, 0.2);
  border-radius: 24px;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  background: #f8f9fa;
  color: #2d3748;
  transition: var(--transition-smooth);
  outline: none;
}

.msger-input:focus {
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

.msger-input::placeholder {
  color: #a0aec0;
}

.msger-send-btn {
  padding: 14px 28px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-bounce);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.msger-send-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.msger-send-btn:hover::before {
  width: 300px;
  height: 300px;
}

.msger-send-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-md);
}

.msger-send-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667eea;
  animation: typing 1.4s infinite;
  opacity: 0.6;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .msger {
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .msg-bubble {
    max-width: 85%;
  }
  
  .msger-header {
    font-size: 1.25rem;
    padding: 20px;
  }
  
  .msger-chat {
    padding: 16px;
  }
  
  .msger-inputarea {
    padding: 16px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}